#ifndef ROUTER_LOAD_H
#define ROUTER_LOAD_H

#include "lane.h"
#include "channel.h"
#include "node.h"
#include <complex>

#include "ip/fabrics.h"

typedef struct NodeRouterLoadParam
{
    int multiplexer;
    List<List<int>> routing_map;
} NodeRouterLoadParam;

class NodeRouterLoad : public Node
{
public:
    int const_multiplexer;
    List<int> reg_mask_map;
    int reg_mask;
    bool reg_is_routing;
    List<bool> reg_dispatch;
    int reg_in_pid;
    int reg_in_addr;
    std::complex<float> reg_in_data;
    int reg_in_sb_addr;
    int reg_in_ain_addr;
    bool reg_in_clr;
    bool reg_dispatch_in_progress;
    ChannelLoadFabricReceiver * port_receiver;
    LaneChannelLoadFabricBusReceiver * port_receiver_lane;
    List<ChannelLoadFabricSender *> port_senders;
    List<LaneChannelLoadFabricBusSender *> port_sender_lanes;

    NodeRouterLoad(Node *parent, NodeRouterLoadParam params);
    NodeTaskList tasks() const override;

    void task_routing();
};

#endif // ROUTER_LOAD_H